package mdt.utils;

/**
 * Created by lambert on 2016/7/20.
 */
public class StringUtils {
	public static String decodeXmlString(String str) {
		if (str == null || str.trim().length() == 0) {
			return str;
		}
		str = str.replaceAll("&lt;", "<")
				.replaceAll("&gt;", ">")
				.replaceAll("&apos;", "&apos;")
				.replaceAll("&quot;", "\"")
				.replaceAll("&amp;", "&");
		return str;
	}

	public static String encodeXmlString(String str) {
		str = str.replaceAll("&", "&amp;")
				.replaceAll("<", "&lt;")
				.replaceAll(">", "&gt;" )
				.replaceAll("&apos;", "&apos;")
				.replaceAll("\"", "&quot;");
		return str;
	}
}
